package com.fishery.customization.service.impl;

import com.fishery.customization.dao.DraggableModuleDao;
import com.fishery.customization.entity.DraggableModule;
import com.fishery.customization.service.DraggableModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DraggableModuleServiceImpl implements DraggableModuleService {


	@Autowired
	private DraggableModuleDao draggableModuleDao;


	@Override
	public List<DraggableModule> getAllDraggableModules() {
		return draggableModuleDao.findAll();
	}

	@Override
	public boolean removeDraggableModuleById(String id) {
		return draggableModuleDao.deleteById(id) > 0;
	}

	@Override
	public boolean updateDraggableModuleById(DraggableModule draggableModule) {
		return draggableModuleDao.updateById(draggableModule) > 0;
	}

	@Override
	public boolean saveDraggableModule(DraggableModule draggableModule) {
		return draggableModuleDao.insert(draggableModule) > 0;
	}

	@Override
	public boolean saveDraggableModule(List<DraggableModule> modules) {
		return draggableModuleDao.insertAll(modules) > 0;
	}

	@Override
	public boolean removeDraggableModuleWithBatch(List<String> ids) {
		return draggableModuleDao.deleteAll(ids) > 0;
	}
}
